package ThreadDemo;

public class ThreadDemo08 {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(){
            @Override
            public void run() {
                while(!Thread.interrupted()) {
                    System.out.println("我正在转账，别烦我");
                }
                System.out.println("转账被终止");
            }
        };
        t.start();
        Thread.sleep(500);
        t.interrupt();
    }
}
